package com.example.qxfw.qxzs.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.zy.TrafficSmallScale;
import com.example.qxfw.qxzs.mapper.TrafficSmallScaleMapper;
import com.example.qxfw.qxzs.service.TrafficSmallScaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

@Service
public class TrafficSmallScaleServiceImpl implements TrafficSmallScaleService {

    @Autowired
    private TrafficSmallScaleMapper trafficSmallScaleMapper;

    @Override
    public List<TrafficSmallScale> listByParam(String observTime1, String observTime2, String stationId) {
        return trafficSmallScaleMapper.selectList(Wrappers.<TrafficSmallScale>query()
                .select( "stationid", "stationname","drybulbtemp as maxtemp", "drybulbtemp as mintemp", "rain", "drybulbtemp", "stationpress", "relhumidity", "stationpress as MaxStationPress", "stationpress as MinStationPress")
                .lambda()
                .between(TrafficSmallScale::getObservtime, Timestamp.valueOf(observTime1),Timestamp.valueOf(observTime2))
                .orderByAsc(TrafficSmallScale::getStationid,TrafficSmallScale::getObservtime));
    }
}
